package com.ruoyi.project.lely.bean.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import javax.validation.constraints.NotEmpty;
import org.hibernate.validator.constraints.Length;

/**
 * 管理员
 *
 * @author luoyong
 */
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@TableName(value = "`ly_admin`", autoResultMap = true)
public class LyAdmin {


    @ApiModelProperty("ID")
    @TableId("id")
    private Long id;


    @Length(max = 63, message = "管理员名称长度不能超过63位")
    @NotEmpty
    @ApiModelProperty("管理员名称")
    @TableField(value = "`username`")
    private String username;


    @Length(max = 63, message = "管理员密码长度不能超过63位")
    @NotEmpty
    @ApiModelProperty("管理员密码")
    @TableField(value = "`password`")
    private String password;


    @Length(max = 63, message = "最近一次登录IP地址长度不能超过63位")
    @ApiModelProperty("最近一次登录IP地址")
    @TableField(value = "`last_login_ip`")
    private String lastLoginIp;


    @ApiModelProperty("最近一次登录时间")
    @TableField(value = "`last_login_time`")
    private LocalDateTime lastLoginTime;


    @Length(max = 255, message = "头像图片长度不能超过255位")
    @ApiModelProperty("头像图片")
    @TableField(value = "`avatar`")
    private String avatar;


    @ApiModelProperty("创建时间")
    @TableField(value = "`create_time`", fill = FieldFill.INSERT)
    private LocalDateTime createTime;


    @ApiModelProperty("更新时间")
    @TableField(value = "`update_time`", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


    @ApiModelProperty("逻辑删除")
    @TableField(value = "`deleted`", fill = FieldFill.INSERT)
    private Integer deleted;


    @Length(max = 127, message = "角色列表长度不能超过127位")
    @ApiModelProperty("角色列表")
    @TableField(value = "`role_ids`")
    private String roleIds;


    @Length(max = 1024, message = "用户描述长度不能超过1024位")
    @ApiModelProperty("用户描述")
    @TableField(value = "`desc`")
    private String desc;


    @Length(max = 16, message = "联系电话长度不能超过16位")
    @ApiModelProperty("联系电话")
    @TableField(value = "`tel`")
    private String tel;


    @Length(max = 64, message = "邮箱地址长度不能超过64位")
    @ApiModelProperty("邮箱地址")
    @TableField(value = "`mail`")
    private String mail;

}
